﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RazonSocial.aspx.cs" Inherits="RazonSocial" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="aspj" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxDataView" tagprefix="dxdv" %>

<%@ Register src="MenuSuperior.ascx" tagname="MenuSuperior" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="App_Themes/Aqua/default.css" rel="stylesheet" type="text/css" />
    <title>Chrono - Razon Social</title>
</head>
<body>
    <form id="form1" runat="server" defaultbutton="btnBuscar" 
    defaultfocus="txtBuscar">
    <div>
        <uc1:MenuSuperior ID="MenuSuperior1" runat="server" />
        <table cellspacing="1" align="center" width="400px">
            <tr>
                <td align="center" bgcolor="White" class="style3">
                    <table align="center">
                        <tr>
                            <td>
                                <asp:TextBox ID="txtBuscar" runat="server" 
                                    ontextchanged="txtBuscar_TextChanged"></asp:TextBox>
                            </td>
                            <td>
                                <asp:ImageButton ID="btnBuscar" runat="server" Height="22px" 
                                    ImageUrl="~/images/lupa.gif" onclick="btnBuscar_Click1" ToolTip="Buscar" 
                                    CausesValidation="False" />
                            </td>
                            
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:Label ID="lblMensaje" runat="server" Visible="False"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="center" bgcolor="White" class="style3">
                    <asp:FormView ID="fvRazonSocial" runat="server" DataSourceID="dsRazonSocial" 
                        DataKeyNames="ID" onitemdeleted="FormView1_ItemDeleted">
                        <EditItemTemplate>
                            <table>
                                <tr>
                                    <td>
                                        Nombre</td>
                                    <td>
                                        <asp:TextBox ID="NombreTextBox0" runat="server" Text='<%# Bind("Nombre") %>' />
                                        <br />
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                            ControlToValidate="NombreTextBox0" Display="Dynamic" 
                                            ErrorMessage="RequiredFieldValidator" ForeColor="Red">Debe ingresar un nombre</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                        &nbsp;&nbsp;</td>
                                </tr>
                            </table>
                            <table align="center">
                                <tr>
                                    <td>
                                        <dxe:ASPxButton ID="btnActualizar" runat="server" CommandName="Update" 
                                            Text="Actualizar">
                                        </dxe:ASPxButton>
                                    </td>
                                    <td>
                                        <dxe:ASPxButton ID="btnCancelar" runat="server" CausesValidation="False" 
                                            CommandName="Cancel" Text="Cancelar">
                                        </dxe:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </EditItemTemplate>
                        <EmptyDataTemplate>
                            <dxe:ASPxButton ID="btnNuevo" runat="server" CommandName="New" 
                                Text="Nueva RazonSocial">
                            </dxe:ASPxButton>
                        </EmptyDataTemplate>
                        <InsertItemTemplate>
                            <table>
                                <tr>
                                    <td>
                                        Nombre</td>
                                    <td>
                                        <asp:TextBox ID="NombreTextBox" runat="server" Text='<%# Bind("Nombre") %>' />
                                        <br />
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                            ControlToValidate="NombreTextBox" Display="Dynamic" 
                                            ErrorMessage="Debe ingresar un nombre" ForeColor="Red"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                        &nbsp;&nbsp;</td>
                                </tr>
                            </table>
                            <table align="center">
                                <tr>
                                    <td>
                                        <dxe:ASPxButton ID="btnInsertar" runat="server" CommandName="Insert" 
                                            Text="Insertar">
                                        </dxe:ASPxButton>
                                    </td>
                                    <td>
                                        <dxe:ASPxButton ID="btnCancelar" runat="server" CausesValidation="False" 
                                            CommandName="Cancel" Text="Cancelar">
                                        </dxe:ASPxButton>
                                    </td>
                                </tr>
                            </table>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td>
                                        Nombre</td>
                                    <td>
                                        <asp:Label ID="NombreLabel" runat="server" Text='<%# Bind("Nombre") %>' />
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <table align="center">
                                <tr>
                                    <td>
                                        <dxe:ASPxButton ID="btnEditar" runat="server" CommandName="Edit" Text="Editar">
                                        </dxe:ASPxButton>
                                    </td>
                                    <td>
                                        <dxe:ASPxButton ID="btnNuevo" runat="server" CommandName="New" Text="Nuevo">
                                        </dxe:ASPxButton>
                                    </td>
                                    <td>
                                        <dxe:ASPxButton ID="btnEliminar" runat="server" 
                                            ClientInstanceName="btnEliminar" CommandName="Delete" Text="Eliminar">
                                            <ClientSideEvents Click="function(s,e) { e.processOnServer = confirm('Va a eliminar la RazonSocial, ¿está seguro?'); }" />
                                        </dxe:ASPxButton>
                                    </td>
                                </tr>
                            </table>

                        </ItemTemplate>
                    </asp:FormView>
                    <asp:ObjectDataSource ID="dsRazonSocial" runat="server" SelectMethod="ObtenerPorID" 
                        TypeName="RC.ControlAcceso.ObjetosNegocio.CA2RazonSocial" 
                        oninserted="dsUsuario_Inserted" 
                        DataObjectTypeName="RC.ControlAcceso.ObjetosNegocio.CA2RazonSocial" 
                        DeleteMethod="Eliminar" InsertMethod="Insertar" 
                        OldValuesParameterFormatString="original_{0}" UpdateMethod="Actualizar">
                        <SelectParameters>
                            <asp:QueryStringParameter DefaultValue="-1" Name="pIDidRazonSocial" QueryStringField="ID" 
                                Type="Int32" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                </td>
            </tr>
        </table>
        <br />
        <dxpc:ASPxPopupControl ID="popBusqueda" runat="server" 
            AutoUpdatePosition="True" 
            EnableHotTrack="False" 
            HeaderText="Razones sociales encontradas" 
            Modal="True" 
            PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
            <CloseButtonImage Height="12px" Width="13px" />
            <SizeGripImage Height="16px" Width="16px" />
            <HeaderStyle>
            <Paddings PaddingRight="6px" />
            </HeaderStyle>
            <ContentCollection>
<dxpc:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
    <dxwgv:ASPxGridView ID="gvPersonalColeccion0" runat="server" 
        AutoGenerateColumns="False" 
        DataSourceID="dsRazonesSociales" KeyFieldName="ID" Width="100%">
        <Columns>
            <dxwgv:GridViewDataTextColumn 
                ShowInCustomizationForm="True" VisibleIndex="1" 
                Caption="Razón social" FieldName="Nombre">
                <DataItemTemplate>
                    <a ID="clickElement" href="RazonSocial.aspx?ID=<%# Container.KeyValue%>" 
                        target="_self"><%# Eval("Nombre")%></a>
                </DataItemTemplate>
                <CellStyle Wrap="False">
                </CellStyle>
            </dxwgv:GridViewDataTextColumn>
        </Columns>
        <SettingsBehavior AllowFocusedRow="True" EnableRowHotTrack="True" />
        <SettingsPager PageSize="20">
        </SettingsPager>
        <Styles>
            <Header ImageSpacing="5px" SortingImageSpacing="5px">
            </Header>
            <LoadingPanel ImageSpacing="10px">
            </LoadingPanel>
        </Styles>
        <StylesEditors>
            <ProgressBar Height="25px">
            </ProgressBar>
        </StylesEditors>
        <Templates>
            <EmptyDataRow>
                <br />
                <span class="dxncEmptyData_Soft_Orange">No se encontraron registros</span><br />
            </EmptyDataRow>
        </Templates>
    </dxwgv:ASPxGridView>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:ObjectDataSource ID="dsRazonesSociales" runat="server" 
        SelectMethod="ObtenerPorValor" 
        TypeName="RC.ControlAcceso.ObjetosNegocio.CA2RazonSocial" 
        OnSelecting="dsUsuarios_Selecting" 
        OldValuesParameterFormatString="original_{0}">
        <SelectParameters>
            <asp:ControlParameter ControlID="txtBuscar" Name="pValor" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
                </dxpc:PopupControlContentControl>
</ContentCollection>
        </dxpc:ASPxPopupControl>
    
    </div>
    </form>
</body>
</html>
